{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from bokeh.charts import BoxPlot, output_notebook, show, defaults\n",
    "from bokeh.sampledata.autompg import autompg as df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "defaults.width = 450\n",
    "defaults.height = 350"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "box_plot = BoxPlot(df, label='cyl', values='mpg',\n",
    "                   title=\"label='cyl', values='mpg'\")\n",
    "show(box_plot)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "box_plot2 = BoxPlot(df, label=['cyl', 'origin'], values='mpg',\n",
    "                    title=\"label=['cyl', 'origin'], values='mpg'\")\n",
    "show(box_plot2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "box_plot3 = BoxPlot(df, label='cyl', values='mpg', color='cyl',\n",
    "                    title=\"label='cyl' values='mpg'\")\n",
    "show(box_plot3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# use constant fill color\n",
    "box_plot4 = BoxPlot(df, label='cyl', values='displ',\n",
    "                    title=\"label='cyl' color='blue'\",\n",
    "                    color='blue')\n",
    "show(box_plot4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# color by one dimension and label by two dimensions\n",
    "box_plot5 = BoxPlot(df, label=['cyl', 'origin'], values='mpg',\n",
    "                    title=\"label=['cyl', 'origin'] color='cyl'\",\n",
    "                    color='cyl')\n",
    "show(box_plot5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# specify custom marker for outliers\n",
    "box_plot6 = BoxPlot(df, label='cyl', values='mpg', marker='cross',\n",
    "                    title=\"label='cyl', values='mpg', marker='cross'\")\n",
    "show(box_plot6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# color whisker by cylinder\n",
    "box_plot7 = BoxPlot(df, label='cyl', values='mpg', whisker_color='cyl',\n",
    "                    title=\"label='cyl', values='mpg', whisker_color='cyl'\")\n",
    "show(box_plot7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# remove outliers\n",
    "box_plot8 = BoxPlot(df, label='cyl', values='mpg', outliers=False,\n",
    "                    title=\"label='cyl', values='mpg', outliers=False\")\n",
    "show(box_plot8)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
